$(document).ready   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 5
rs 9.4285
c 1
b 0
f 1
1
jQuery(document).ready(function() {
2
	if( typeof wpapi_gmaps !== 'undefined' ){
0 ignored issues
show
Bug introduced by
The variable wpapi_gmaps seems to be never declared. If this is a global, consider adding a /** global: wpapi_gmaps */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
3
		google.maps.event.addDomListener(window, 'load', initialize_map );
0 ignored issues
show
Bug introduced by
The variable google seems to be never declared. If this is a global, consider adding a /** global: google */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
4
	}
5
});
6
7
// Initialize map
8
function initialize_map() {
9
	wpapi_gmaps.forEach(function(single_gmap, index){
0 ignored issues
show
Bug introduced by
The variable wpapi_gmaps seems to be never declared. If this is a global, consider adding a /** global: wpapi_gmaps */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
10
		var mapCanvas = document.getElementById('wpapi-gmap-' + index);
11
		var myLatLng = new google.maps.LatLng( single_gmap.lat , single_gmap.lng );
0 ignored issues
show
Bug introduced by
The variable google seems to be never declared. If this is a global, consider adding a /** global: google */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
12
		var map_style = JSON.parse(single_gmap.style);
13
		var map_zoom = single_gmap.scrollwheel ? false : true;
14
15
		var mapOptions = {
16
			center: myLatLng,
17
			zoom: Number(single_gmap.zoom),
18
			scrollwheel:  map_zoom,
19
			mapTypeId: google.maps.MapTypeId.ROADMAP,
20
			styles: map_style
21
		}
22
23
		var marker = new google.maps.Marker({
24
			position: myLatLng
25
		});
26
27
		var infoContent =  single_gmap.info;
28
		var infowindow = new google.maps.InfoWindow({
29
			content: infoContent
30
		});
31
32
		var map = new google.maps.Map(mapCanvas, mapOptions);
33
		marker.setMap(map);
34
		infowindow.open(map, marker);
35
	});
36
}
37